package com.chujian.framework.core.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.chujian.framework.core.IId;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础通用实体类
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString(callSuper = true)
public abstract class BaseEntity implements Serializable, IId {

    @ApiModelProperty(value = "创建人ID")
    @TableField(value = "create_user_id", fill = FieldFill.INSERT, whereStrategy = FieldStrategy.NOT_EMPTY)
    protected Long createUserId;

    @ApiModelProperty(value = "创建人名称")
    @TableField(value = "create_user_name", fill = FieldFill.INSERT, whereStrategy = FieldStrategy.NOT_EMPTY)
    protected String createUserName;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT, whereStrategy = FieldStrategy.NOT_EMPTY)
    protected LocalDateTime createTime;

    @ApiModelProperty(value = "最后修改人ID")
    @TableField(value = "modify_user_id", fill = FieldFill.INSERT_UPDATE, whereStrategy = FieldStrategy.NOT_EMPTY)
    protected Long modifyUserId;

    @ApiModelProperty(value = "最后修改时间")
    @TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE, whereStrategy = FieldStrategy.NOT_EMPTY)
    protected LocalDateTime modifyTime;

    @ApiModelProperty(value = "备注")
    @TableField(value = "remark")
    protected String remark;

    @ApiModelProperty(value = "删除标记")
    @TableLogic
    @TableField(value = "delete_flag")
    protected Boolean deleteFlag;

}
